package com.itheima.create;

public class ArrayDemo2 {
    public static void main(String[] args) {
        // 目标：学习数组的访问格式：数组名称[索引]   数组名称.length
        String[] names = {"全蛋", "二狗", "西门"};
        //                  0      1       2

        // 取值
        System.out.println(names[0]);
        System.out.println(names[1]);
        System.out.println(names[2]);

        // 赋值
        names[2] = "西门吹牛";
        System.out.println(names[2]);

        // 数组的长度：其实就是数组的元素个数
        System.out.println(names.length);

        // 最大索引
        System.out.println(names.length - 1);

        int[] arr = {};
        System.out.println(arr.length - 1);
    }
}
